home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11165 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: risky.ecs.umass.edu!usenet
  2. From: jvinson@cheux.ecs.umass.edu (Jack Vinson)
  3. Newsgroups: comp.lang.c++
  4. Subject: passing references to containers?
  5. Date: 12 Mar 1996 18:36:47 -0500
  6. Organization: University of Massachusetts
  7. Message-ID: <wozq9lc29c.fsf@cheux.ecs.umass.edu>
  8. NNTP-Posting-Host: cheux.ecs.umass.edu
  9. X-Newsreader: September Gnus v0.51/Emacs 19.30
  10.  
  11.  
  12. Is it legal to pass references to template containers of classes?  I think
  13. it is, but my compiler is giving me error messages.
  14.  
  15. I have a basic array template that does bound-checking in the [] operator.
  16. I want to pass these arrays around by reference to reduce the amount of
  17. creating and destroying going on.  
  18.  
  19. However, in SOME cases, the compiler complains when I try to access
  20. elements of the given array (this is MSVC 2.0):
  21.  
  22.     error C2676: binary '[' : 'class array<class stream_frame>' does not
  23.     define this operator or a conversion to a type acceptable to the
  24.     predefined operator 
  25.  
  26.  
  27. I've also just noticed that for two files in which this happens, if I add
  28. an #include directive one of the files no longer has the error, while the
  29. other still has the problems.
  30.  
  31.  
  32. Thanks for any clues.
  33.  
  34. -- 
  35. Jack Vinson                   The Purple Puddle Eater and Captain Jack
  36. jvinson@cheux.ecs.umass.edu   <http://www.cis.upenn.edu/~vinson/home.html>
  37. Sunderland, MA
  38. "Skin ain't got no tailored pockets."    - Eat _Sell_Me_a_God_
  39.